package com.example.music;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.Toast;
/**
 * 原歌单
 * 现music list
 * @author Administrator
 *
 */
public class categoryOfSong extends Activity implements OnItemClickListener{
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
//		setContentView(R.layout.tablayout2);
		ListView list =new ListView(this);
		Cursor curosr=getContentResolver().query(
				MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
				new String[]{
						MediaStore.Audio.Media._ID,
						MediaStore.Audio.Media.TITLE,
						MediaStore.Audio.Media.ARTIST},
						null, null, null);
		startManagingCursor(curosr);
		ListAdapter listAdapter=new SimpleCursorAdapter(
				this, R.layout.listview, curosr,
				new String[]{
						MediaStore.Audio.Media._ID,
						MediaStore.Audio.Media.TITLE,
						MediaStore.Audio.Media.ARTIST
						}, 
						new int[]{R.id.textView,R.id.name,R.id.number});
		list.setAdapter(listAdapter);
		setContentView(list);
		list.setOnItemClickListener(this);
		
		
	}

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		// TODO Auto-generated method stub
		Toast.makeText(this, "musci"+arg2, Toast.LENGTH_SHORT).show();
	}
	

}
